package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.victor.dao.ProblemDao;
import com.victor.entity.Problem;
import com.victor.service.ProblemService;

@Service
public class ProblemServiceImpl implements ProblemService {

	@Autowired
	private ProblemDao problemDao;

	// 获取问题列表（传类型）type 1.问答题,2.选择题,3.连线题,4.拼图题
	@Override
	public List<Problem> getAllProblem(String type) {
		return problemDao.getAllProblem(type);
	}

	// 新建问题
	@Override
	public boolean createNewProblem(Problem problem) {
		return problemDao.createNewProblem(problem) > 0 ? true : false;
	}

	// 批量删除问题
	@Override
	public boolean batchDeleteProblem(int[] ids) {
		return problemDao.batchDeleteProblem(ids) > 0 ? true : false;
	}

	// 修改问题信息
	@Override
	public boolean updateProblem(Problem problem) {
		return problemDao.updateProblem(problem) > 0 ? true : false;
	}
}
